#include "ExtCS.h"

#include <stdio.h>

#include <windows.h>

#include <dbgeng.h>

//#include "OutputCallBack.h"

StdioOutputCallbacks g_OutputCb;

STDMETHODIMP

StdioOutputCallbacks::QueryInterface(

    THIS_

    IN REFIID InterfaceId,

    OUT PVOID* Interface

    )

{

    *Interface = NULL;

    if (IsEqualIID(InterfaceId, __uuidof(IUnknown)) ||

        IsEqualIID(InterfaceId, __uuidof(IDebugOutputCallbacks)))

    {

        *Interface = (IDebugOutputCallbacks *)this;

        AddRef();

        return S_OK;

    }

    else

    {

        return E_NOINTERFACE;

    }

}

STDMETHODIMP_(ULONG)

StdioOutputCallbacks::AddRef(

    THIS

    )

{

    // This class is designed to be static so

    // there's no true refcount.

    return 1;

}

STDMETHODIMP_(ULONG)

StdioOutputCallbacks::Release(

    THIS

    )

{

    // This class is designed to be static so

    // there's no true refcount.

    return 0;

}

STDMETHODIMP

StdioOutputCallbacks::Output(

    THIS_

    IN ULONG Mask,

    IN PCSTR Text

    )

{

    UNREFERENCED_PARAMETER(Mask);

                        m_OutputBuffer += Text;
						//dprintf(Text);
    return S_OK;

}


void StdioOutputCallbacks::InitOutPutBuffer()

{

                        m_OutputBuffer.erase();

}